package com.vvlive.caibao.smartcity.ui;

import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.RadioButton;
import android.widget.SeekBar;

import com.vvlive.caibao.smartcity.base.BaseActivity;
import com.vvlive.caibao.smartcity.view.CommonActionBar;

import org.kymjs.kjframe.ui.BindView;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by android on 2015/7/4.
 * <p/>
 * 空调控制页面
 */
public class AirConditioningControlActivity extends BaseActivity implements OnCheckedChangeListener {

    @BindView(id = R.id.temp_control)
    SeekBar mTempControl;
    @BindView(id = R.id.fan_control)
    SeekBar mFanControl;

    @BindView(id = R.id.aircontrol_heat, click = true)
    RadioButton mHeat;
    @BindView(id = R.id.aircontrol_wet, click = true)
    RadioButton mWet;
    @BindView(id = R.id.aircontrol_cold, click = true)
    RadioButton mCold;
    @BindView(id = R.id.aircontrol_dry, click = true)
    RadioButton mDry;
    @BindView(id = R.id.aircontrol_sleep, click = true)
    RadioButton mSleep;


    @Override
    protected int getContentViewRes() {
        return R.layout.activity_ariconditioning_control;
    }

    @Override
    public void initWidget() {
        super.initWidget();
        CommonActionBar commonActionBar = getCommonActionBar();
        commonActionBar.setTitle(R.string.ari_c_control);
        CheckBox checkBox = new CheckBox(this);
        checkBox.setButtonDrawable(R.drawable.switch_btn_ok);
        checkBox.setOnCheckedChangeListener(this);
        commonActionBar.setMoreView(checkBox);
    }

    @Override
    public void widgetClick(View v) {
        super.widgetClick(v);
        switch (v.getId()) {
            case R.id.aircontrol_heat:  // 辅热
//                toast("辅热");
                break;
            case R.id.aircontrol_wet:   // 加湿
//                toast("加湿");
                break;
            case R.id.aircontrol_cold:  // 制冷
//                toast("制冷");
                break;
            case R.id.aircontrol_dry:   // 干燥
//                toast("干燥");
                break;
            case R.id.aircontrol_sleep: // 睡眠
//                toast("睡眠");
                break;
        }
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) {
            turnOn();
        } else {
            turnOff();
        }
    }

    /**
     * 开启空调
     */
    private void turnOn() {
        toast("开启空调");
    }

    /**
     * 关闭空调
     */
    private void turnOff() {
        toast("关闭空调");
    }
}
